import { WatchStopHandle } from "vue";


export enum MsgCodes {
  //车辆控制
  START = 101,//"一键启动",
  PARKING = 102,//"电子驻车",
  Gears = 103,//"换挡杆",
  ACCELERATOR_PEDAL = 104,//"加速踏板",
  BRAKE_PEDAL = 105,//"制动踏板",
  STEERING_WHEEL = 106,//"方向盘",
  TRUMPET = 107,//"喇叭",

  //舱盖锁
  HOOD_SWITCH = 201,//"引擎盖开关",
  TRUNK_SWITCH = 202,//"行李箱盖开关",
  LOCK_CAR_DOOR = 203,//"车门锁",
  UNLOCK_CAR_DOOR = 204,//"车门解锁",
  TRUNK_CLOSE_SWITCH = 205,//"行李箱关闭按钮";
  TRUNK_MACHINERY_SWITCH = 206,//"行李箱机械拉锁";
  
  //后视镜
  REARVIEW_MIRROR_FOLD = 301,//"折叠",
  REARVIEW_MIRROR_HEATER = 302,//"加热",
  REARVIEW_MIRROR_ACTIVATE_LEFT = 303,//"激活左调节",
  REARVIEW_MIRROR_ACTIVATE_OFF = 304,//"取消激活",
  REARVIEW_MIRROR_ACTIVATE_RIGHT = 305,//"激活右调节",
  REARVIEW_MIRROR_ADJUST_UP = 306,//"镜片上调节",
  REARVIEW_MIRROR_ADJUST_DOWN = 307,//"镜片下调节",
  REARVIEW_MIRROR_ADJUST_LEFT = 308,//"镜片左调节",
  REARVIEW_MIRROR_ADJUST_RIGHT = 309,//"镜片右调节",

  //驾驶员车窗开关
  WINDOW_MAIN_LFU = 401,//"驾驶员车窗左前升按钮",
  WINDOW_MAIN_LFD = 402,//"驾驶员车窗左前降按钮",
  WINDOW_MAIN_RFU = 403,//"驾驶员车窗右前升按钮",
  WINDOW_MAIN_RFD = 404,//"驾驶员车窗右前降按钮",
  WINDOW_MAIN_LBU = 405,//"驾驶员车窗左后升按钮",
  WINDOW_MAIN_LBD = 406,//"驾驶员车窗左后降按钮",
  WINDOW_MAIN_RBU = 407,//"驾驶员车窗右后升按钮",
  WINDOW_MAIN_RBD = 408,//"驾驶员车窗右后降按钮",
  LOCK_CAR_WINDOW = 409,//"车窗锁按钮",

  //乘客车窗开关
  WINDOW_RFU = 501,//"乘客车窗右前升按钮",
  WINDOW_RFD = 502,//"乘客车窗右前降按钮",
  WINDOW_LBU = 503,//"乘客车窗左后升按钮",
  WINDOW_LBD = 504,//"乘客车窗左后降按钮",
  WINDOW_RBU = 505,//"乘客车窗右后升按钮",
  WINDOW_RBD = 506,//"乘客车窗右后降按钮",

  //灯光开关
  LIGHT_TURN_LEFT = 601,//"左转向挡",
  LIGHT_TURN_RIGHT = 602,// "右转向挡",
  LIGHT_HEAD_NEAR = 603,//"近光挡",
  LIGHT_HEAD_DISTANCE = 604,//"远光挡",
  LIGHT_HEAD_FLASH = 605,//超车挡",

  //灯光开关
  LIGHT_OFF = 701,//"灯光关闭",
  LIGHT_AUTO = 702,// "自动灯光",
  LIGHT_LAMPLET_SWITCH = 703,//"小灯",
  LIGHT_HEADLAMP_SWITCH = 704,//"大灯",
  LIGHT_FRONT_FOG = 705,//前雾灯",
  LIGHT_REAR_FOG = 706,//后雾灯",

  //雨刮开关
  WIPER_FRONT_ONCE = 801,//"前雨刮只刮一次挡";
  WIPER_FRONT_CLSOE = 802,//"前雨刮关闭挡";
  WIPER_FRONT_INTERVAL = 803,//"前雨刮间歇挡";
  WIPER_FRONT_LOW = 804,//"前雨刮低速挡";
  WIPER_FRONT_HIGHT = 805,//"前雨刮高速挡";
  WIPER_FRONT_SPRAY = 806,//"前雨刮喷水挡";
  WIPER_REAR_CLOSE = 807,//"后雨刮关闭挡";
  WIPER_REAR_OPEN = 808,//"后雨刮打开挡";
  WIPER_REAR_SPRAY = 809,//"后雨刮喷水挡";

  //遥控器
  REMOTEKEY_TRUNKLID_UNLOCK = 901,//"遥控器后备箱解锁";
  REMOTEKEY_LOCK = 902,//"遥控器车辆锁止";
  REMOTEKEY_UNLOCK = 903,//"遥控器车辆解锁";

  //UI状态同步
  APPEARENCE_UI_START = 500,//"一键启动",
  APPEARENCE_UI_PARKING = 501,//"电子驻车",
  APPEARENCE_UI_Gears = 502,//"换挡杆",
  APPEARENCE_UI_ACCELERATOR_PEDAL = 503,//"加速踏板",
  APPEARENCE_UI_BRAKE_PEDAL = 504,//"制动踏板",
  APPEARENCE_UI_STEERING_WHEEL = 505,//"方向盘",
  APPEARENCE_UI_TRUMPET = 506,//"喇叭",

  //舱盖锁
  APPEARENCE_UI_HOOD_SWITCH = 507,//"引擎盖开关",
  APPEARENCE_UI_TRUNK_SWITCH = 508,//"行李箱盖开关",
  APPEARENCE_UI_LOCK_CAR_DOOR = 509,//"车门锁",
  APPEARENCE_UI_UNLOCK_CAR_DOOR = 510,//"车门解锁",


  //后视镜
  APPEARENCE_UI_REARVIEW_MIRROR_FOLD = 511,//"折叠",
  APPEARENCE_UI_REARVIEW_MIRROR_HEATER = 512,//"加热",
  APPEARENCE_UI_REARVIEW_MIRROR_ACTIVATE_LEFT = 513,//"激活左调节",
  APPEARENCE_UI_REARVIEW_MIRROR_ACTIVATE_OFF = 514,//"取消激活",
  APPEARENCE_UI_REARVIEW_MIRROR_ACTIVATE_RIGHT = 515,//"激活右调节",
  APPEARENCE_UI_REARVIEW_MIRROR_ADJUST_UP = 516,//"镜片上调节",
  APPEARENCE_UI_REARVIEW_MIRROR_ADJUST_DOWN = 517,//"镜片下调节",
  APPEARENCE_UI_REARVIEW_MIRROR_ADJUST_LEFT = 518,//"镜片左调节",
  APPEARENCE_UI_REARVIEW_MIRROR_ADJUST_RIGHT = 519,//"镜片右调节",

  //驾驶员车窗开关
  APPEARENCE_UI_WINDOW_MAIN_LFU = 520,//"驾驶员车窗左前升按钮",
  APPEARENCE_UI_WINDOW_MAIN_LFD = 521,//"驾驶员车窗左前降按钮",
  APPEARENCE_UI_WINDOW_MAIN_RFU = 522,//"驾驶员车窗右前升按钮",
  APPEARENCE_UI_WINDOW_MAIN_RFD = 523,//"驾驶员车窗右前降按钮",
  APPEARENCE_UI_WINDOW_MAIN_LBU = 524,//"驾驶员车窗左后升按钮",
  APPEARENCE_UI_WINDOW_MAIN_LBD = 525,//"驾驶员车窗左后降按钮",
  APPEARENCE_UI_WINDOW_MAIN_RBU = 526,//"驾驶员车窗右后升按钮",
  APPEARENCE_UI_WINDOW_MAIN_RBD = 527,//"驾驶员车窗右后降按钮",
  APPEARENCE_UI_LOCK_CAR_WINDOW = 528,//"车窗锁按钮",

  //乘客车窗开关
  APPEARENCE_UI_WINDOW_RFU = 529,//"乘客车窗右前升按钮",
  APPEARENCE_UI_WINDOW_RFD = 530,//"乘客车窗右前降按钮",
  APPEARENCE_UI_WINDOW_LBU = 531,//"乘客车窗左后升按钮",
  APPEARENCE_UI_WINDOW_LBD = 532,//"乘客车窗左后降按钮",
  APPEARENCE_UI_WINDOW_RBU = 533,//"乘客车窗右后升按钮",
  APPEARENCE_UI_WINDOW_RBD = 534,//"乘客车窗右后降按钮",

  //灯光开关
  APPEARENCE_UI_LIGHT_TURN_LEFT = 535,//"左转向挡",
  APPEARENCE_UI_LIGHT_TURN_RIGHT = 536,// "右转向挡",
  APPEARENCE_UI_LIGHT_HEAD_NEAR = 537,//"近光挡",
  APPEARENCE_UI_LIGHT_HEAD_DISTANCE = 538,//"远光挡",
  APPEARENCE_UI_LIGHT_HEAD_FLASH = 539,//超车挡",

  //灯光开关
  APPEARENCE_UI_LIGHT_OFF = 540,//"灯光关闭",
  APPEARENCE_UI_LIGHT_AUTO = 541,// "自动灯光",
  APPEARENCE_UI_LIGHT_LAMPLET_SWITCH = 542,//"小灯",
  APPEARENCE_UI_LIGHT_HEADLAMP_SWITCH = 543,//"大灯",
  APPEARENCE_UI_LIGHT_FRONT_FOG = 544,//前雾灯",
  APPEARENCE_UI_LIGHT_REAR_FOG = 545,//后雾灯",

  //雨刮开关
  APPEARENCE_UI_WIPER_FRONT_ONCE = 546,//"前雨刮只刮一次挡",
  APPEARENCE_UI_WIPER_FRONT_CLSOE = 547,//"前雨刮关闭挡",
  APPEARENCE_UI_WIPER_FRONT_INTERVAL = 548,//"前雨刮间歇挡",
  APPEARENCE_UI_WIPER_FRONT_LOW = 549,//"前雨刮低速挡",
  APPEARENCE_UI_WIPER_FRONT_HIGHT = 550,//"前雨刮高速挡",
  APPEARENCE_UI_WIPER_FRONT_SPRAY = 551,//"前雨刮喷水挡",
  APPEARENCE_UI_WIPER_REAR_CLOSE = 552,//"后雨刮关闭挡",
  APPEARENCE_UI_WIPER_REAR_OPEN = 553,//"后雨刮打开挡",
  APPEARENCE_UI_WIPER_REAR_SPRAY = 554,//"后雨刮喷水挡",

  APPEARENCE_UI_REMOTEKEY_LOCK = 555,//"车辆锁";
  APPEARENCE_UI_REMOTEKEY_UNLOCK = 556,//"车辆解锁";

  //空调
  APPEARENCE_UI_AIR_FORNT_GEAR = 560,//空调前档除雾
  APPEARENCE_UI_AIR_BACK_GEAR = 561,//空调后档除雾
  APPEARENCE_UI_AIR_OUTLET_UP = 562,//空调出风口上
  APPEARENCE_UI_AIR_OUTLET_MID = 563,//空调出风口中
  APPEARENCE_UI_AIR_OUTLET_DOWN = 564,//空调出风口下
  APPEARENCE_UI_AIR_AUTO = 565,//空调自动
  APPEARENCE_UI_AIR_CLOSE = 566,//空调关
  APPEARENCE_UI_AIR_INNERLOOP = 567,//空调内循环
  APPEARENCE_UI_AIR_VOLUME = 568,//空调风量
  
  //座椅
  APPEARENCE_UI_MAINSEATHEATING = 570,//主驾座椅加热
  APPEARENCE_UI_PASSENGERSEATHEATING = 571,//副驾座椅加热
  APPEARENCE_UI_MAINSEAT_MOVE_FRONT = 572,//主驾座椅前移动
  APPEARENCE_UI_MAINSEAT_MOVE_BACK = 573,//主驾座椅后移动
  APPEARENCE_UI_MAINSEAT_MOVE_BACKREST_FRONT = 574,//主驾座椅靠背前移动
  APPEARENCE_UI_MAINSEAT_MOVE_BACKREST_BACK = 575,//主驾座椅靠背后移动
  APPEARENCE_UI_MAINSEAT_MOVE_UP = 576,//主驾座椅上移动
  APPEARENCE_UI_MAINSEAT_MOVE_DOWN = 577,//主驾座椅下移动
  APPEARENCE_UI_PASSENGERSEAT_MOVE_FRONT = 578,//副驾座椅前移动
  APPEARENCE_UI_PASSENGERSEAT_MOVE_BACK = 579,//副驾座椅后移动
  APPEARENCE_UI_PASSENGERSEAT_MOVE_BACKREST_FRONT = 580,//副驾座椅靠背前移动
  APPEARENCE_UI_PASSENGERSEAT_MOVE_BACKREST_BACK = 581,//副驾座椅靠背后移动

  //空调控制
  POWER_SWITCH_CONTROLER = 1101,//空调开关
  WIND_VELOCITY_CONTROLLER = 1102,//空调风量
  AIR_SYNC_CONTROLLER = 1103,//空调内外循环
  AIR_AUTO_CONTROLLER = 1104,//空调自动
  FRONT_DEFROST_SWITCH_CONTROLLER = 1105,//空调前除雾
  REAR_DEFROST_SWITCH_CONTROLLER = 1106,//空调后除雾
  AIR_OUTLETUP_CONTROLLER = 1107,//空调出风口上
  AIR_OUTLETMID_CONTROLLER = 1108,//空调出风口中
  AIR_OUTLETDOWN_CONTROLLER = 1109,//空调出风口下
  
  //座椅控制
  MAINSEAT_HEATING_CONTROLLER = 1110,//主驾加热
  PASSENGERSEAT_HEATING_CONTROLLER = 1111,//副驾加热
  MAINSEAT_BACKREST_FRONT_CONTROLLER = 1112,//主驾座椅靠背前控制
  MAINSEAT_BACKREST_BACK_CONTROLLER = 1113,//主驾座椅靠背后控制
  MAINSEAT_CUSHION_FRONT_CONTROLLER = 1114,//主驾座椅坐垫前控制
  MAINSEAT_CUSHION_BACK_CONTROLLER = 1115,//主驾座椅坐垫后控制
  MAINSEAT_HEIGHT_UP_CONTROLLER = 1116,//主驾座椅高低上控制
  MAINSEAT_HEIGHT_DOWN_CONTROLLER = 1117,//主驾座椅高低下控制
  PASSENGERSEAT_BACKREST_UP_CONTROLLER = 1118,//副驾座椅靠背前控制
  PASSENGERSEAT_BACKREST_DOWN_CONTROLLER = 1119,//副驾座椅靠背后控制
  PASSENGERSEAT_CUSHION_FRONT_CONTROLLER = 1120,//副驾座椅坐垫前控制
  PASSENGERSEAT_CUSHION_BACK_CONTROLLER = 1121,//副驾座椅坐垫后控制
}



/**
 * 消息码
 */
export default class ObjectControllerCode {
  private static instance: ObjectControllerCode = new ObjectControllerCode();
  /**
   * 消息码
   */
  public static get Default(): ObjectControllerCode {
    return this.instance;
  }

  constructor() {
    window.addEventListener('unload', this.Dispose.bind(this));
  }

  Dispose() {
    window.removeEventListener('unload', this.Dispose);
    for (const watchStopHandle of this.watchStopHandles) {
      watchStopHandle();
    }
    this.watchStopHandles.clear();
  }


  public MsgCodesList = MsgCodes

  private watchStopHandles: Array<WatchStopHandle> = [];

  public async Awake(): Promise<void> {
  }

  public async Destroy(): Promise<void> {
  }
}